package com.njtoyo.taxi.entity.backend;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.taxi.entity.json.PointCustomerSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import org.geolatte.geom.Point;

import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * @Author Dell
 * @Date 2021/6/9 15:53
 */
@Entity
@Table(name = "admin_user")
@Accessors(chain = true)
@Data
public class AdminUser {

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;

    private String account;

    private String mobileNumber;

    private String email;

    @JsonIgnore
    private String password;

    @Enumerated
    private Enum.AccountType accountType;

    private String fakeMultiple;

    private Boolean isFool;

    private Date createdAt;

    private Date updatedAt;

    /**
     * 1正常  -1禁用
     */
    private Integer  userState;


    @JsonIgnore
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "user_role_mapping", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
    private Set<Role> roles;

    @Transient
    private AdminUser superior;
    
    private Integer superiorId;

    @Transient
    private List<String> resourceNames;

    @Transient
    private Object identity;

    @JsonIgnore
    @Column(columnDefinition = "geometry(Point,4326)")
    @JsonSerialize(using = PointCustomerSerializer.class)
    private Point defaultPoint;

    private Boolean isPhoneOnline;

}
